<template>
  <div class="collection">
 <van-nav-bar
  title="我的收藏"
  left-text="返回"
  right-text="..."
  left-arrow
  @click-left="onClick"
 
/>
<div class="right">
        <div  class="item" v-for="(item,index) in favlist" :key="index">
          <img :src="item.picUrl" alt="">
          <div class="right1">
            <div class="names">{{item.name}}</div>
            <span class="min_price">{{item.averagePriceTip}}</span> <br>
            <span class="month_saled_content">配送距离{{item.distance}}</span> <br>
            <span class="promotion_info">{{item.monthSalesTip}}</span>
            <span>{{item.unit}}</span>
          </div>
        </div>
      </div>
  </div>
</template>

<script>
import { shop_favlist } from "../api/api";
export default {
    data(){
        return{
            favlist:[],
            userid:null
        }
    },
methods:{
    onClick(){
        this.$router.go(-1)
    }
},
mounted(){
    var userid=localStorage.getItem('userid')
     console.log(userid);
   
    shop_favlist({params:{userid:userid}}).then((res)=>{
        console.log(res.data);
        this.favlist=res.data.list
    })
}
}
</script>

<style scoped>
.right{
  width: 65%;
  height: 350px;
  
}
.item img{
  width: 100px;
  height: 100px;
}
.item{
  display: flex;
  justify-content: space-around;
  margin-bottom: 20px;
  width: 375px;
 
}
.right1 span{
margin-right: 5px;
}
.right1{
    width: 300px;;
}
</style>